﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using PMS.SANY.Util;

namespace PMS.SANY.Entity
{
    /// <summary>
    /// 关重件信息
    /// </summary>
    public partial class StationExecutedKey : BusEntity
    {
        /// <summary>
        /// 生产报工编号
        /// </summary>
        public string ExecutedId { set; get; }

        /// <summary>
        /// 关重件物料号
        /// </summary>
        public string MaterialNo { get; set; }

        /// <summary>
        /// 关重件序列号
        /// </summary>
        public string MaterialSerialNo { get; set; }
    }

    public partial class StationExecutedKey : BusEntity
    {
        public virtual StationExecuted Executed { set; get; }
    }

    /// <summary>
    /// 实体配置
    /// OnModelCreating
    /// </summary>
    public class StationExecutedKeyTypeConfig : BusEntityTypeConfig<StationExecutedKey>, IEntityTypeConfiguration<StationExecutedKey>
    {
        public override void Configure(EntityTypeBuilder<StationExecutedKey> builder)
        {
            base.Configure(builder);

            #region 主外键关系
            #endregion

            #region 字段属性:最大长度,是否必需,默认值
            builder.Property(p => p.ExecutedId).HasMaxLength(EntityDefinition.DefSmallColLen).IsRequired();
            builder.Property(p => p.MaterialNo).HasMaxLength(60).IsRequired();
            builder.Property(p => p.MaterialSerialNo).HasMaxLength(60);
            #endregion

            #region 备注
            builder.HasComment("关重件信息");
            builder.Property(p => p.ExecutedId).HasComment("生产报工编号");
            builder.Property(p => p.MaterialNo).HasComment("关重件物料号");
            builder.Property(p => p.MaterialSerialNo).HasComment("关重件序列号");
            #endregion

            #region 种子数据
            #endregion
        }
    }
}
